from .base_model import BaseModel
from django.db import models
from django.contrib.auth.models import User

class Grade(BaseModel):
    """年级模型"""
    name = models.CharField(max_length=50, verbose_name="年级名称")
    level = models.IntegerField(unique=True, verbose_name="年级级别", help_text="数字表示,如1表示一年级")
    grade_leader = models.ForeignKey(
        User,
        on_delete=models.SET_NULL,
        null=True,
        blank=True,
        related_name='led_grades',
        verbose_name="年级组长"
    )

    def __str__(self):
        return self.name

    class Meta:
        verbose_name = "年级"
        verbose_name_plural = "年级"